package com.srs.backend.controller;

import com.srs.backend.service.ReviewService;
import com.srs.backend.utils.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/api/review")
public class ReviewController {
    @Resource
    private ReviewService reviewService;

    @PostMapping("/add/")
    public Result add(@RequestBody Map<String, String> data) {
        return reviewService.add(data);
    }

    @PostMapping("/delete/")
    public Result delete(@RequestBody Map<String, String> data) {
        return reviewService.delete(data);
    }

    @PostMapping("/modify/")
    public Result modify(@RequestBody Map<String, String> data) {
        return reviewService.modify(data);
    }

    @PostMapping("/get/all/")
    public Result getAll() {
        return reviewService.getAll();
    }

    @PostMapping("/add/review/by/food/id/")
    public Result addReviewByFoodId(@RequestBody Map<String, String> data) {
        return reviewService.addReviewByFoodId(data);
    }
    @PostMapping("/add/review/by/server/id/")
    public Result addReviewByServerId(@RequestBody Map<String, String> data) {
        return reviewService.addReviewByServerId(data);
    }
    @PostMapping("/get/review/rank/about/food/")
    public Result getReviewRankAboutFood(@RequestBody Map<String, String> data) {
        return reviewService.getReviewRankAboutFood(data);
    }
    @PostMapping("/get/review/rank/about/server/")
    public Result getReviewRankAboutServer(@RequestBody Map<String, String> data) {
        return reviewService.getReviewRankAboutServer(data);
    }
}
